
import {ExpandedModel} from "@/components/plugs/tree/TreeView.ts";

export interface TableColumn{
    field: string;
    desc: string;
    width?:number;
    dicType?:string;
    fixed?: 'none' | 'left' | 'right';
    isSlot: boolean,
    colFormatVal?: (rowData:{},dicData:{},colIndex:number,rowIndex:number) => string; //isSlot: false  时候调用
}

export enum TableModel{
    TREE = 1,
    NORMAL = 2
}

export enum CheckModel {
    SINGLE = 1,
    MULTIPLE = 2
}

export interface TreeConfig{
    idField:string;
    pIdField:string;
    rootId:string;
    expand?:boolean;
    expandModel?:ExpandedModel;
}

export interface TableOptions{
    url: any;
    columns: TableColumn[];
    pageLimit?:Array<number>
    handleDic?:boolean;
    tableModel?:TableModel;
    checkModel?:CheckModel;
    treeConfig?:TreeConfig;
    params?:any
    showCheckBox?: boolean;
    showPage?:boolean;
    showLineNumber?:boolean;
    width?: string | number;
    height?: string | number;
    data?: object[];
    headFixed?: boolean;
    fixedCheckbox?: boolean;
    fixedLineNumber?: boolean;
    onRowCheckedChange?: (selected:boolean,rowData:object,rowIndex:number) => void;
    onRowClick?: (rowData:object,rowIndex:number) => void;
    onRowDblClick?: (rowData:object,rowIndex:number) => void;
    onAllCheckedChange?:(selected:boolean,data:object[]) => void;
    loadSuccess?:(data:object[]) => void;
}